package com.ghpt.controller;
import com.ghpt.pojo.JiZhong;
import com.ghpt.service.JiZhongService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/jizhong")
public class JiZhongController {
    private final JiZhongService jiZhongService;

    public JiZhongController(JiZhongService jiZhongService) {
        this.jiZhongService = jiZhongService;
    }
    @GetMapping("/{id}")
    public JiZhong getJiZhongById(@PathVariable Long id) {
        System.out.println("结果是"+jiZhongService.findJiZhongById(id));
        return jiZhongService.findJiZhongById(id);
    }
    @PutMapping
    public int updateJiZhong(@RequestBody JiZhong jiZhong) {
        return jiZhongService.updateById(jiZhong);
    }
}
